package deng.qiya.everplay;

import java.io.File;

import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.ImageSwitcher;


public class AsyncImageTask extends AsyncTask<String, Integer, Uri> {

	private DownloadService dwnService;
	//private List<Integer> loadList ;
	private ImageSwitcher imageSwitcher;
	private File everPlayPath;
	
	
	public AsyncImageTask(DownloadService dwnService,ImageSwitcher imageSwitcher,File everPlayPath) {
		Log.d("result aaa", "AsyncImageTask");
		this.dwnService = dwnService;
		this.imageSwitcher = imageSwitcher;
		this.everPlayPath = everPlayPath;
	}

	@Override
	protected Uri doInBackground(String... params) {
		
		Log.d("result aaa", "doInBackground");
		for(String param:params){
			Log.d("TestAsyncTask","param:"+param );
		}
		try {
			return dwnService.getImageURI(params[0], everPlayPath);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@Override
	protected void onPostExecute(Uri result) {
		//super.onPostExecute(result); 
		Log.d("result aaa", "resultreulst"+result.toString());
		Integer i = Integer.valueOf(1);
		//this.loadList.add(i);
		if (result != null) {
			Log.d("result ddd", "resultreulst"+result);
			//imageSwitcher.setImageURI(result);
		}
	}
	
	//public static void asyncloadImage(String path,ImageSwitcher imageSwitcher) {
	//}
}